package com.xiaoxin.factory.simplefactory;

import com.xiaoxin.factory.simplefactory.service.ICourse;
import com.xiaoxin.factory.simplefactory.service.impl.JavaCourse;
import com.xiaoxin.factory.simplefactory.service.impl.PythonCourse;

/**
 * @Description: 简单工厂模式
 * @Author: xiaoXin
 * @Date: 2019/12/10 23:33
 */
public class CourseFactory {

    public ICourse ceate(String name) {
        if ("java".equals(name)) {
            return new JavaCourse();
        } else if ("python".equals(name)) {
            return new PythonCourse();
        } else {
            System.out.println("没有此课程");
            return null;
        }
    }
}
